//
//  TQQListModel.swift
//  SwiftLearning
//
//  Created by 黄龙 on 2024/1/22.
//

import UIKit

class TQQListModel: NSObject {
    var title:String?
    var targetVC:String?
    var titleString:NSMutableAttributedString?
    
//    static func initWith(title:String,targetVC:String)->TQQListModel{
//        return TQQListModel(title: title, targetVC: targetVC)
//    }
    
    init(title: String, targetVC: String) {
        self.title = title
        self.targetVC = targetVC
    }
    
    func createAttributedString(_ index:Int){
        if let title = self.title{
            let fullStirng = String(format: "%02ld. %@", index,title)
            let richString = NSMutableAttributedString(string: fullStirng)
            richString.addAttribute(.font, value: UIFont(name: "Heiti SC", size: 16) as Any, range: NSMakeRange(0, richString.length))
            richString.addAttribute(.font, value: UIFont(name: "GillSans-Italic", size: 16) as Any, range: NSMakeRange(0, 3))
            richString.addAttribute(.foregroundColor, value: UIColor.systemOrange, range: NSMakeRange(0, richString.length))
            richString.addAttribute(.foregroundColor, value: UIColor.systemRed, range: NSMakeRange(0, 3))
            self.titleString = richString;
        }else{
            self.titleString = nil;
        }
    }
    
}
